package com.dsbj.mp.icardservice.utils.jwt;

import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

@Data
public class JWTInfo implements IJWTInfo {
	
	private String openId;
	private String employeeNo;
	private String name;
	
	public JWTInfo(String openId, String employeeNo, String name) {
		this.openId = openId;
		this.employeeNo = employeeNo;
		this.name = name;
	}
	
	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		
		JWTInfo jwtInfo = (JWTInfo) o;
		
		if (!Objects.equals(openId, jwtInfo.openId)) {
			return false;
		}
		if (!Objects.equals(employeeNo, jwtInfo.employeeNo)) {
			return false;
		}
		return Objects.equals(name, jwtInfo.name);
	}
	
	@Override
	public int hashCode() {
		int result = openId != null ? openId.hashCode() : 0;
		result = 31 * result + (employeeNo != null ? employeeNo.hashCode() : 0);
		return result;
	}
}
